<?php 
$url = "http://localhost:8080/moms-diary/services/authenticate";
/*
$ch = curl_init($url);
//$fp = fopen("example_homepage.txt", "w");

//curl_setopt($ch, CURLOPT_FILE, $fp);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_HTTPGET, true);
//curl_setopt($ch, CURLOPT_RETURNTRANSFER, false);
curl_setopt($ch, CURLOPT_USERPWD, 'brainmaster716@gmail.com:123');
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);

$data = curl_exec($ch);
$return =  curl_getinfo($ch);
print_r($data);
curl_close($ch);
//fclose($fp);
*/
$context = stream_context_create(array(
    'http' => array(
        'header'  => "Authorization: Basic " . base64_encode("rm.herwidodo@babytivities.com:234")
	)
));
$data = file_get_contents($url, false, $context);
if(isset($data)) {
	$json = json_decode($data, TRUE);
	print_r($json);
}
?>
